package com.cntaiping.workutil.indicator;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;


public abstract class IndicatorService{
    Log logger = LogFactory.getLog(IndicatorService.class);

    protected boolean condition;

    protected BlockingQueue<LogRecord> BLOCKING_QUEUE;

    protected LogProfile logProfile;



    public IndicatorService(LogProfile logProfile){
        this.BLOCKING_QUEUE = new ArrayBlockingQueue<>(200);
        this.logProfile = logProfile;
        condition = true;
        createDaemonThread();
    }


    /**
     * 创建守护线程
     */
    protected abstract void createDaemonThread();

    /**
     * 队列中增加日志
     */
    public abstract boolean offerQueueMessage(LogRecord logRecord);

    /**
     * 守护线程读取日志
     */
    protected abstract void takeQueueMessage(LogRecord logRecord);

    protected abstract boolean sendToAim();

    protected abstract boolean sendToLogServer();



}
